#include <iostream>
#include <cmath>

class Point
{
public:
    Point() : m_x(0), m_y(0) {}
    Point(int x, int y) : m_x(x), m_y(y) {}

    void show()
    {
        std::cout << "(" << m_x << "," << m_y << ")" << std::endl;
    }
    // 友元函数的声明
    friend double Distance(const Point &p1, const Point &p2);

    // 友元类的声明
    friend class Tool;

private:
    int m_x;
    int m_y;
};

class Tool
{
public:
    static double Distance2Zero(const Point &p1)
    {
        return std::sqrt(std::pow(p1.m_x, 2) + std::pow(p1.m_y, 2));
    }
};

double Distance(const Point &p1, const Point &p2)
{
    return std::sqrt(std::pow((p1.m_x - p2.m_x), 2) + std::pow((p1.m_y - p2.m_y), 2));
}

int main()
{
    Point p1;
    p1.show();
    Point p2(1, 2);
    p2.show();

    std::cout << Distance(p1, p2) << std::endl;

    std::cout << Tool::Distance2Zero(p2) << std::endl;

    return 0;
}